POV-Ray : Newsgroups : povray.general : texturing in csg : Re: texturing in csg Server Time
8 Aug 2024 01:22:25 EDT (-0400)
  Re: texturing in csg  
From: Francois Labreque
Date: 26 Mar 2001 20:08:10
Message: <3ABFE731.4DB35D6B@videotron.ca>
Dave B wrote:
> 
> Somebody correct me if I am wrong

Since you asked...

> but I do believe that the texture
> statements for your second and third objects should be inside the objects
> {}.
> i.e.
> 
> #declare Obj1=union{
>    mesh{
>      /* triangles */
>      texture{Gray}
>    }
>    cylinder{*cylinder definition* texture{Black} } // <= THIS
>    sphere{*sphere definition* texture{Black} } // <= AND THIS
>    }
> 
> I think this should sort your problem.

This will work of course, but is overkill the real way textures are
evaluated is:

If there is an object-specific texture,
    use it.
Else
    If there is a CSG-specific texture
        use it.
    Else
        Use the default values.
    
I have been unable to reproduce the problem Wlodimierz is having.  See
p.b.i. for examples, using the following scene:

// test file
#declare Black = color red 0 green 0 blue 0;
#declare Gray = color red 0.5 green 0.5 blue 0.5
#declare White = color red 1 green 1 blue 1;

// The camera, lights and floor are my "standard test scene".
camera { location <0, 8, -10> look_at <0, 4, 0> angle 60 }
light_source { < -20, 20, 0 > color red 0.3 green 0.3 blue 0.3 }
light_source { < 20, 20, 0 > color red 0.3 green 0.3 blue 0.3 }
light_source { < 0, 50, -50 > color red 0.3 green 0.3 blue 0.3 }
   
plane { y, 0 texture { pigment { color White } } }

#declare Obj1=union{
    //I used a sphere instead of a mesh, it's simpler
    sphere{ < 0, 2, 0 > 2 texture{ pigment { color Gray } } }
    cylinder{ < 0, 2, 0 > < 4, 2, 0 > 1 }
    sphere{ < 4, 2, 0 > 2 }
    texture{ pigment { color Black }}
}

#local Obj2=union{
  object{ Obj1 translate < -2, 2, 0 > }
  box { < -2, 0, -2 > < 2, 2, 2 > }
  texture{ pigment { color Gray } }
  rotate 45*y
}

object{ Obj2 texture{ pigment { color Gray } } }
//end of file

I think Wlodimierz will have to post actual code and images to see what
is going on.


-- 
Francois Labreque | The surest sign of the existence of extra-
    flabreque     | terrestrial intelligence is that they never
        @         | bothered to come down here and visit us!
  videotron.ca    |                             - Calvin


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.